//-----------------------------------------------------------
//
//-----------------------------------------------------------
class ManaPickUp extends TournamentPickUp
    notplaceable;
#exec OBJ LOAD FILE=E_Pickups.usx


var int MaxManaIncrease;

function RespawnEffect()
{
  spawn(class'PlayerSpawnEffect');
}

simulated static function UpdateHUD(HUD H)
{
  H.LastPickupTime = H.Level.TimeSeconds;
  HUDEnyara(H).LastManaPickupTime = H.LastPickupTime;
}

static function string GetLocalString(
  optional int Switch,
  optional PlayerReplicationInfo RelatedPRI_1,
  optional PlayerReplicationInfo RelatedPRI_2
  )
{
  return default.PickupMessage$Default.MaxManaIncrease;
}

auto state Pickup
{
  /* ValidTouch()
   Validate touch (if valid return true to let other pick me up and trigger event).
  */
  function bool ValidTouch( actor Other )
  {
    // make sure its a live player
    if ( (Pawn(Other) == None) || !Pawn(Other).bCanPickupInventory || (Pawn(Other).DrivenVehicle == None && Pawn(Other).Controller == None) || !Pawn(Other).Controller.bIsPlayer )
      return false;

    // make sure not touching through wall
    if ( !FastTrace(Other.Location, Location) )
      return false;

    // make sure game will let player pick me up
    if( Level.Game.PickupQuery(Pawn(Other), self) )
    {
      TriggerEvent(Event, self, Pawn(Other));
      return true;
    }
    return false;
  }


  function Touch( actor Other )
  {
    local Pawn P;
    local EnyaraPlayerController EPC;

    if ( ValidTouch(Other) )
    {
      P = Pawn(Other);
      EPC = EnyaraPlayerController(P.Controller);

            if (EPC.restoreMana(EPC.ManaMax+MaxManaIncrease,EPC.ManaMax+MaxManaIncrease))
            {
               //EPC.ClientMessage("Your Maximum Mana Has Increased By 25.",'CriticalEvent');
               AnnouncePickup(P);
               Destroy();
               //SetRespawn();

            }
    }
  }
}

function float BotDesireability( pawn Bot )
{
  return 0.0;
}

DefaultProperties
{
     PickupMessage="Your Maximum Mana Has Increased By "
     MaxManaIncrease=25
     MaxDesireability=0.7
     RespawnTime=
     AmbientGlow=128
     CollisionRadius=32.000000
     CollisionHeight=23.000000
     Mass=10.000000
     PickupSound=Sound'PickupSounds.HealthPack'
     DrawType=DT_StaticMesh
     StaticMesh=StaticMesh'XGame_rc.BombEffectMesh'
     CullDistance=6500.000000
     Physics=PHYS_Rotating
     DrawScale=0.300000
     ScaleGlow=0.600000
     Style=STY_AlphaZ
     TransientSoundVolume=0.350000
     RotationRate=(Yaw=24000)



}
